package br.com.salao.session;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.com.salao.ejb.dao.DiaSemanaDao;
import br.com.salao.ejb.dao.impl.DiaSemanaDaoImpl;
import br.com.salao.entity.DiaSemana;

@Stateless
@Remote(DiaSemanaBase.class)
public class DiaSemanaBean implements DiaSemanaBase{

	/**
	 * @author Dri
	 */
	private static final long serialVersionUID = 1L;

	@PersistenceContext(unitName = "SalaoBeleza")
	private EntityManager em;

	public DiaSemanaBean(){
		//em = JpaUtil.getEntityManager();	
	}

	@TransactionAttribute
	public DiaSemana incluir(DiaSemana diaSemana){
		DiaSemanaDao diaSemanaDao = new DiaSemanaDaoImpl(em);
		return diaSemanaDao.inserir(diaSemana);
	}

	@TransactionAttribute
	public DiaSemana update(DiaSemana diaSemana){
		DiaSemanaDao diaSemanaDao = new DiaSemanaDaoImpl(em);
		return diaSemanaDao.update(diaSemana);
	}

	@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
	public DiaSemana buscarDiaSemanaPorIdEstabelecimentos(int idEstabelecimento){
		DiaSemanaDao diaSemanaDao = new DiaSemanaDaoImpl(em);
		return diaSemanaDao.buscarDiaSemanaPorIdEstabelecimentos(idEstabelecimento);
	}

}
